home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 January - Disc 2 / Macworld (1999-01) (Disk 2).dmg / Serious Demos / Symbolic Composer 4.2 / Environment / System / MRAC / Variations / pick1 < prev    next >
Lisp/Scheme  |  1998-08-11  |  446b  |  16 lines

  1. pick1 seed pattern
  2.  
  3. Use this function as a building block in complex expressions which need a tool for picking elements using a random generator from a list or lists. The random seed enables the composer to recapture a particular choice. Setting the random seed to nil disables this facility.
  4.  
  5. (pick1 .32 '(a b c d))
  6. => b
  7.  
  8. (setq len (qlength '((12-010) (20-103) (8-01))))
  9.  
  10. (pick1 nil len)
  11. => (-1/12 1/12 -1/12)
  12. ...
  13.  
  14. (pick1 .35 len)
  15. => (-1/8 1/8)
  16.